#include "staticobject.h"
#include "Engine2D/dxsprite.h"

StaticObject::StaticObject()
{ }

StaticObject::StaticObject(Sprite* pS, float x, float y, int _layer)
{	
    /*if (mSprite.find(nameObj) == mSprite.end())
    {	
        char path[100] = "Data\\Mario Sprites\\";
        strcat(path, nameObj);
        strcat(path, ".png");
        mSprite[nameObj] = new DXSprite(path, D3DCOLOR_XRGB(0, 0, 0), 1, 1);
    }*/
    pSprite = pS;
    posX = x;
    posY = y;
    layer = _layer;
    originX = 0;
    originY = 0;
}

Rect StaticObject::GetRectBound()
{	
    Rect bound = {posX, posY, posX + pSprite->GetWidth(), posY + pSprite->GetHeight()};
    return bound;
}

int StaticObject::GetLayer()
{	
    return layer;
}

void StaticObject::SetOrigin(float x, float y)
{	
    originX = x;
    originY = y;
    return;
}

void StaticObject::Update(unsigned int gameTime)
{ }

void StaticObject::Render(unsigned int gameTime)
{	
    if (pSprite != 0)
    {	
        pSprite->SetPosition(posX - originX, posY - originY);
        pSprite->Draw();
    }
    return;
}

StaticObject::~StaticObject()
{ }